<template>
    <div class='approval'>
        <el-card class="box-card" style="margin-top: 110px;">
            <div class="head-title2">
                <div class='title'>
                    {{$t('achievements.title1')}}
                </div>
                <div class="info">
                    <el-tooltip placement="left">
                    <div slot="content">
                        {{define}}
                    </div>
                    <div class="btns"></div>
                    </el-tooltip>
                </div>
            </div>
            <div class='menu-search'> 
                <div class='menu-title'>
                    <!-- 业务ID -->
                    <div class='searchItem'>
                        <span>{{$t('lenders.orderId')}}</span>
                        <el-input v-model='listQuery.orderId' :placeholder="$t('rule.orderId')" size='small'></el-input>
                    </div>
                    <!-- 客户姓名 -->
                    <div class='searchItem'>
                        <span>{{$t('lenders.realName')}}</span>
                        <el-input v-model='listQuery.realName' :placeholder="$t('rule.realName')" size='small'></el-input>
                    </div>
                    <!-- 手机号 -->
                    <div class='searchItem'>
                        <span>{{$t('lenders.phoneNo')}}</span>
                        <el-input v-model='listQuery.phoneNo' :placeholder="$t('rule.phoneNo')" size='small'></el-input>
                    </div>
                    <!-- 订单状态 -->
                    <div class='searchItem'>
                        <span>{{$t('dispatch.orderStatus')}}</span>
                        <el-select v-model='listQuery.orderStatus' size='small'>
                            <el-option
                            v-for='item in orderStatus'
                            :key='item.value'
                            :label='item.label'
                            :value='item.value'>
                            </el-option>
                        </el-select>
                    </div>
                    <!-- 催收小组 -->
                    <div class='searchItem'>
                        <span>{{$t('dispatch.gcoll')}}</span>
                        <el-select v-model='listQuery.collectCode' size='small'>
                            <el-option
                            v-for='item in collGroup'
                            :key='item.code'
                            :label='item.name'
                            :value='item.code'>
                            </el-option>
                        </el-select>
                    </div>
                    <!-- 逾期天数 -->
                    <div class="searchItem searchItem-overdue">
                        <span>{{$t('dispatch.overDay')}}</span>
                        <el-input v-model='listQuery.overDayBegin' size='small'></el-input>
                        <b style="font-weight: normal; margin: 0 10px;font-size: 12px; color: #5f5f61;">{{$t('lenders.go')}}</b>
                        <el-input v-model='listQuery.overDayEnd' size='small'></el-input>
                        <b style="font-weight: normal; margin-left: 10px;font-size: 12px; color: #5f5f61;">{{$t('dispatch.day')}}</b>
                    </div>
                    <!-- 逾期时间 -->
                    <div class='searchItem searchItem-date'>
                        <span>{{$t('dispatch.overdueTime')}}</span>
                        <el-date-picker
                            size="small"
                            v-model="overdueDate"
                            type="daterange"
                            :range-separator="$t('btn.go')"
                            :start-placeholder="$t('rule.beginDate')"
                            :end-placeholder="$t('rule.endDate')"
                            value-format="yyyy-MM-dd"
                            @change="dateChangeOverdueTime"
                        ></el-date-picker>
                    </div>
                    <!-- 结清还款时间 -->
                    <div class="searchItem searchItem-date">
                        <span>{{$t('dispatch.settleTime')}}</span>
                        <el-date-picker
                            size="small"
                            v-model="settleRepayDate"
                            type="daterange"
                            :range-separator="$t('btn.go')"
                            :start-placeholder="$t('rule.beginDate')"
                            :end-placeholder="$t('rule.endDate')"
                            value-format="yyyy-MM-dd"
                            @change="dateChangesettleRepayDate"
                        ></el-date-picker>
                    </div>
                </div>
                <div class='menu-title-btn'>
                  <button type='button' @click='search'>
                      {{$t('btn.query')}}
                  </button>
                  <button type='button' @click='reset'>
                      {{$t('btn.reset')}}
                  </button>
                  <button type='button' @click="handleDownload" :disabled="expDis"  v-if="achievement_btn_export">
                      {{$t('btn.export')}}
                  </button>
              </div>
            </div>
        </el-card>
        <el-card class='box-card' style="margin-top: 10px;margin-bottom: 20px;">
            <div class='title'>
                {{$t('dispatch.taskList')}}
            </div>
            <!-- <div class='menu-list'>
                <button type='button' :disabled='isDisable2' @click='approvalFn'>{{$t('dispatch.collDet')}}</button>
            </div> -->
            <el-table
                stripe
                v-loading="listLoading"
                ref='multipleTable'
                :data='tableData'
                tooltip-effect='dark'
                style='width: 95%'
                class='tables'
                border
                size='mini'>
                <!-- 业务ID -->
                <el-table-column
                prop='orderId' align="center" header-align="center" 
                :label="$t('lenders.orderId')"
                width='140'>
                <template slot-scope="scope">
                    <span class="href" @click="hrefFn(scope.row)">{{scope.row.orderId}}</span>
                </template>
                </el-table-column>
                <!-- 客户姓名 -->
                <el-table-column
                prop='realName' align="center" header-align="center" 
                :label="$t('lenders.realName')"
                width='180'>
                </el-table-column>
                <!-- 手机号 -->
                <el-table-column
                prop='appUserName' align="center" header-align="center" 
                :label="$t('lenders.phoneNo')"
                width='120'>
                </el-table-column>
                <!-- 产品名称 -->
                <el-table-column
                prop='proName' align="center" header-align="center" 
                :label="$t('dispatch.proName')"
                width='90'>
                </el-table-column>
                <!-- 金额 -->
                <el-table-column 
                prop='approvedAmt' align="center" header-align="center" 
                :label="$t('dispatch.appAmt')"
                width='100'>
                </el-table-column>
                <!-- 申请时间 -->
                <el-table-column
                prop="orderCrtTime" align="center" header-align="center" 
                :label="$t('dispatch.orderCrtTime')"
                width='100'>
                </el-table-column>
                <!-- 到期时间 -->
                <el-table-column
                prop="lastPayDate" align="center" header-align="center" 
                :label="$t('dispatch.lastPayDate')"
                width='100'>
                </el-table-column>
                <!-- 首次到期还款时间 -->
                <el-table-column
                prop="firstDueDate" align="center" header-align="center" 
                :label="$t('processing.firstRepayTime')"
                width='150'>
                </el-table-column>
                <!-- 逾期天数 -->
                <el-table-column
                prop="overdueDay" align="center" header-align="center" 
                :label="$t('processing.overdueDay')"
                width='90'>
                </el-table-column>
                <!-- 历史逾期天数 -->
                <el-table-column
                prop="overdueDayNew" align="center" header-align="center" 
                :label="$t('processing.hisOverdueDay')"
                width='120'>
                </el-table-column>
                <!-- 滞纳金 -->
                <el-table-column
                prop='overdueAmt' align="center" header-align="center" 
                :label="$t('dispatch.overdueAmt')"
                width='120'>
                </el-table-column>
                <!-- 逾期利息 -->
                <el-table-column
                prop='overdueInterest' align="center" header-align="center" 
                :label="$t('processing.overdueInterest')"
                width='120'>
                </el-table-column>
                <!-- <el-table-column
                prop='extensionTime'
                :label="$t('dispatch.extensionTime')"
                width='112'>
                </el-table-column> -->
                <!-- 结清还款时间 -->
                <el-table-column
                prop='settleTime' align="center" header-align="center" 
                :label="$t('dispatch.settleTime')"
                width='112'>
                </el-table-column>
                <!-- 领取状态 -->
                <el-table-column
                prop='baseUserName' align="center" header-align="center" 
                :label="$t('dispatch.recStatus')"
                width='90'>
                <template slot-scope="scope">
                    <span v-if="scope.row.baseUserName=== ''">{{$t('dispatch.unreceived')}}</span>
                    <span v-else-if="scope.row.baseUserName=== null">{{$t('dispatch.unreceived')}}</span>
                    <span v-else>{{$t('dispatch.receive')}}</span>
                </template>
                </el-table-column>
                <!-- 催收分组 -->
                <el-table-column
                prop='groupName' align="center" header-align="center" 
                :label="$t('dispatch.collGroup')"
                width='90'>
                </el-table-column>
                <!-- 催收专员 -->
                <el-table-column
                prop='baseUserName' align="center" header-align="center" 
                :label="$t('dispatch.baseUserName')"
                width='90'>
                </el-table-column>
                <!-- 任务状态 -->
                <el-table-column
                prop='status' align="center" header-align="center" 
                :label="$t('dispatch.taskStatus')"
                width='100'>
                <template slot-scope="scope">
                    <span v-if="scope.row.status=== 10">{{$t('dispatch.status1')}}</span>
                    <span v-else-if="scope.row.status === 20">{{$t('dispatch.status2')}}</span>
                    <span v-else-if="scope.row.status === 50">{{$t('dispatch.status3')}}</span>
                    <span v-else>{{$t('dispatch.status4')}}</span>
                </template>
                </el-table-column>
                <!-- 订单状态 -->
                <el-table-column
                prop='orderStatus' align="center" header-align="center" 
                :label="$t('dispatch.orderStatus')"
                width='90'>
                <template slot-scope="scope">
                    <span v-if="scope.row.orderStatus=== 1">{{$t('approval.audit')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 2">{{$t('approval.credit')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 3">{{$t('approval.repayments')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 4">{{$t('approval.refused')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 5">{{$t('approval.clear')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 6">{{$t('dispatch.orderStatus1')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 7">{{$t('dispatch.orderStatus2')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 8">{{$t('orderQuery.status8')}}</span>
                    <span v-else-if="scope.row.orderStatus=== 9">{{$t('orderQuery.status9')}}</span>
                </template>
                </el-table-column>
                <!-- 通话结果 -->
                <el-table-column
                prop='callResult' align="center" header-align="center" 
                :label="$t('dispatch.callResult')"
                width='90'>
                <template slot-scope="scope">
                    <span v-if="scope.row.callResult=== '1'">{{$t('dispatch.normal')}}</span>
                    <span v-else-if="scope.row.callResult=== '2'">{{$t('dispatch.fail')}}</span>
                </template>
                </el-table-column>
                <!-- 失败原因 -->
                <el-table-column
                prop='callFailedReason' align="center" header-align="center" 
                :label="$t('dispatch.callFailedReason')"
                width='90'>
                <template slot-scope="scope">
                    <span v-if="scope.row.callFailedReason=== '1'">{{$t('processing.reason1')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '2'">{{$t('processing.reason2')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '3'">{{$t('processing.reason3')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '4'">{{$t('processing.reason4')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '5'">{{$t('processing.reason5')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '6'">{{$t('processing.reason6')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '7'">{{$t('processing.reason7')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '8'">{{$t('processing.reason8')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '9'">{{$t('processing.reason9')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '10'">{{$t('processing.reason10')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '11'">{{$t('processing.reason11')}}</span>
                    <span v-else-if="scope.row.callFailedReason=== '12'">{{$t('processing.reason12')}}</span>
                </template>
                </el-table-column>
                <!-- 处理结果 -->
                <el-table-column
                prop='dealResult' align="center" header-align="center" 
                :label="$t('dispatch.dealResult')"
                width='90'>
                <template slot-scope="scope">
                    <span v-if="scope.row.dealResult=== '1'">{{$t('processing.result1')}}</span>
                    <span v-else-if="scope.row.dealResult=== '2'">{{$t('processing.result2')}}</span>
                    <span v-else-if="scope.row.dealResult=== '3'">{{$t('processing.result3')}}</span>
                    <span v-else-if="scope.row.dealResult=== '4'">{{$t('processing.result4')}}</span>
                    <span v-else-if="scope.row.dealResult=== '5'">{{$t('processing.result5')}}</span>
                    <span v-else-if="scope.row.dealResult=== '6'">{{$t('processing.result6')}}</span>
                    <span v-else-if="scope.row.dealResult=== '7'">{{$t('processing.result7')}}</span>
                    <span v-else-if="scope.row.dealResult=== '8'">{{$t('processing.result8')}}</span>
                    <span v-else-if="scope.row.dealResult=== '9'">{{$t('processing.result9')}}</span>
                    <span v-else-if="scope.row.dealResult=== '10'">{{$t('processing.result10')}}</span>
                    <span v-else-if="scope.row.dealResult=== '11'">{{$t('processing.result11')}}</span>
                </template>
                </el-table-column>
                <!-- 催收意见 -->
                <el-table-column
                prop='collectRemark' align="center" header-align="center" 
                :label="$t('dispatch.collectRemark')"
                width='180'
                show-overflow-tooltip>
                </el-table-column>
                <!-- 业务渠道 -->
                <el-table-column
                prop='appShortName' align="center" header-align="center" 
                :label="$t('dispatch.appShortName')"
                width='90'>
                </el-table-column>
            </el-table>
            <div class="pagination-container">
                <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="listQuery.page"
                :page-sizes="[5, 10, 15, 20]"
                :page-size="listQuery.limit"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total">
                </el-pagination>
            </div>
        </el-card>
    </div>
</template>

<script>
import { mapGetters } from "vuex";
import { dataMasking } from 'utils/index';
import { page, getCollectGroup, pageExport } from 'api/collection/achievement/index'
export default {
    data() {
        return {
        define: '',
        overdueDate: [],
        settleRepayDate: [new Date(), new Date()],
        achievement_btn_export: false,
        expDis: true,
        listLoading: false,
        listQuery: {
            limit: 5,//每页条数
            page: 1,//当前页数
            orderId: "",//订单号
            realName: "",//姓名
            phoneNo: "",//手机
            beginDate: "",//申请时间
            endDate: "",
            orderStatus: "",//订单状态
            collectCode: "",//催收小组
            overDayBegin: "",//逾期天数
            overDayEnd: "",
            groupId: "",
            beginSettleTime: "", //结清还款时间
            endSettleTime: ""
        },
        total: null,
        tableData: [],
        isDisable2: true,
        lanStatus: null,
        orderStatus: [
            {
                value: '',
                label: this.$t('rule.choose')
            },
            {
                value: 1,
                label: this.$t('orderQuery.status3')
            },
            {
                value: 2,
                label: this.$t('orderQuery.status7')
            },
            {
                value: 3,
                label: this.$t('orderQuery.status5')
            },
            {
                value: 4,
                label: this.$t('orderQuery.status6')
            },
            {
                value: 8,
                label: this.$t('orderQuery.status8')
            },
            {
                value: 9,
                label: this.$t('orderQuery.status9')
            }
        ],
        collGroup: [
            {
                code: '',
                name: this.$t('rule.choose'),
                groupBaseId: ''
            }]
        };
    },
    created() {
        if (this.language === 'zh') {
            this.lanStatus = 1;
        } else if (this.language === 'en') {
            this.lanStatus = 2;
        } else {
            this.lanStatus = 3;
        }
        if (this.collAchiPage.has(this.$route.path)) {
            this.listQuery = this.collAchiPage.get(this.$route.path)
        }
        this.getTime();
        this.getList();
        //催收小组
        let group = {};
        getCollectGroup(group)
        .then(response => {
            if (response.data.hasOwnProperty('collectList')) {
                this.collGroup = this.collGroup.concat(response.data.collectList)
            }
        })
        this.achievement_btn_export = this.elements['achievement:btn_export'];
        // 获取报表定义
        this.getReportDefine.forEach(item => {
        if (item.dictCode === 'COLLECTION_PERFORMANCE_STATISTICS') {
            this.define = item.dictValue
        }
        })
    },
    computed: {
        ...mapGetters(["elements", "language", "collAchiPage", 'getReportDefine'])
    },
    methods: {
        getTime() {
            this.listQuery.beginSettleTime = this.GetDateStr(0);
            this.listQuery.endSettleTime = this.GetDateStr(0);
        },
        GetDateStr(AddDayCount) {
            let dd = new Date();
            dd.setDate(dd.getDate() + AddDayCount);// 获取AddDayCount天后的日期
            let y = dd.getFullYear();
            let m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1); // 获取当前月份的日期，不足10补0
            let d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate(); // 获取当前几号，不足10补0
            return y + '-' + m + '-' + d;
        },
        // 逾期时间
        dateChangeOverdueTime(val) {
            if (val === undefined || val === null || val === '') {
                this.listQuery.beginDate = '';
                this.listQuery.endDate = '';
            } else {
                this.listQuery.beginDate = val[0];
                this.listQuery.endDate = val[1];
            }
        },
        // 结清还款时间时间
        dateChangesettleRepayDate(val) {
            if (val === undefined || val === null || val === '') {
                this.listQuery.beginSettleTime = '';
                this.listQuery.endSettleTime = '';
            } else {
                this.listQuery.beginSettleTime = val[0];
                this.listQuery.endSettleTime = val[1];
            }
        },
        hrefFn(row) {
            this.$store.dispatch('setCollQueryDetail', row)
            this.$router.push({
                path: '/CollectionReport/collQueryDetail', 
                name: '催收查询详情'
            })  
        },
        //导出
        handleDownload() {
            this.listLoading = true;
            this.collGroup.forEach(item => {
                if(item.code === this.listQuery.collectCode) {
                    this.listQuery.groupId = item.groupBaseId
                }
            })
            if (this.tableData.length > 0) {
                this.isDisable2 = false;
            } else {
                this.isDisable2 = true;
            }
            pageExport(this.listQuery)
            .then(response => {
                response.data.forEach(item => {
                    //领取状态
                    if(item.baseUserName === "" || item.baseUserName === null) {
                        item.attr8 = this.$t('dispatch.unreceived')
                    } else{
                        item.attr8 = this.$t('dispatch.receive')
                    }
                    if (item.realName || item.appUserName) {
                        item.realName = dataMasking(item.realName)
                        item.appUserName = dataMasking(item.appUserName)
                    }
                    //订单状态
                    switch (item.orderStatus) {
                        case 1:
                            item.orderStatus = this.$t('approval.audit')
                        break;
                        case 2:
                            item.orderStatus = this.$t('approval.credit')
                        break;
                        case 3:
                            item.orderStatus = this.$t('approval.repayments')
                        break;
                        case 4:
                            item.orderStatus = this.$t('approval.refused')
                        break;
                        case 5:
                            item.orderStatus = this.$t('approval.clear')
                        break;
                        case 6:
                            item.orderStatus = this.$t('dispatch.orderStatus1')
                        break;
                        case 7:
                            item.orderStatus = this.$t('dispatch.orderStatus2')
                        break;
                        case 8:
                            item.orderStatus = this.$t('orderQuery.status8')
                        break;
                        case 9:
                            item.orderStatus = this.$t('orderQuery.status9')
                        break;
                    }
                    //通话结果
                    if(item.callResult === '1') {
                        item.callResult = this.$t('dispatch.normal')
                    } else if(item.callResult === '2'){
                        item.callResult = this.$t('dispatch.fail')
                    }
                    //失败原因
                    switch (item.callFailedReason) {
                        case '1':
                            item.callFailedReason = this.$t('processing.reason1')
                        break;
                        case '2':
                            item.callFailedReason = this.$t('processing.reason2')
                        break;
                        case '3':
                            item.callFailedReason = this.$t('processing.reason3')
                        break;
                        case '4':
                            item.callFailedReason = this.$t('processing.reason4')
                        break;
                        case '5':
                            item.callFailedReason = this.$t('processing.reason5')
                        break;
                        case '6':
                            item.callFailedReason = this.$t('processing.reason6')
                        break;
                        case '7':
                            item.callFailedReason = this.$t('processing.reason7')
                        break;
                        case '8':
                            item.callFailedReason = this.$t('processing.reason8')
                        break;
                        case '9':
                            item.callFailedReason = this.$t('processing.reason9')
                        break;
                        case '10':
                            item.callFailedReason = this.$t('processing.reason10')
                        break;
                        case '11':
                            item.callFailedReason = this.$t('processing.reason11')
                        break;
                        case '12':
                            item.callFailedReason = this.$t('processing.reason12')
                        break;
                    }
                    //处理结果
                    switch (item.dealResult) { 
                        case '1':
                            item.dealResult = this.$t('processing.result1')
                        break;
                        case '2':
                            item.dealResult = this.$t('processing.result2')
                        break;
                        case '3':
                            item.dealResult = this.$t('processing.result3')
                        break;
                        case '4':
                            item.dealResult = this.$t('processing.result4')
                        break;
                        case '5':
                            item.dealResult = this.$t('processing.result5')
                        break;
                        case '6':
                            item.dealResult = this.$t('processing.result6')
                        break;
                        case '7':
                            item.dealResult = this.$t('processing.result7')
                        break;
                        case '8':
                            item.dealResult = this.$t('processing.result8')
                        break;
                        case '9':
                            item.dealResult = this.$t('processing.result9')
                        break;
                        case '10':
                            item.dealResult = this.$t('processing.result10')
                        break;
                        case '11':
                            item.dealResult = this.$t('processing.result11')
                        break;
                    }
                    //任务状态
                    if(item.status === 10) {
                        item.status = this.$t('dispatch.status1')
                    } else if(item.status === 20){
                        item.status = this.$t('dispatch.status2')
                    } else if(item.status === 50){
                        item.status = this.$t('dispatch.status3')
                    } else {
                        item.status = this.$t('dispatch.status4')
                    }
                })
                require.ensure([], () => {
                    const { export_json_to_excel } = require('@/vendor/Export2Excel')
                    const tHeader = [ this.$t('lenders.orderId'), this.$t('lenders.realName'), this.$t('lenders.phoneNo'), this.$t('dispatch.proName'), this.$t('dispatch.appAmt'), this.$t('dispatch.orderCrtTime'), this.$t('dispatch.lastPayDate'), this.$t('processing.firstRepayTime'), this.$t('dispatch.overDay'), this.$t('processing.hisOverdueDay'), this.$t('dispatch.overdueAmt'), this.$t('processing.overdueInterest'), this.$t('dispatch.settleTime'),this.$t('dispatch.recStatus'), this.$t('dispatch.collGroup'), this.$t('dispatch.baseUserName'), this.$t('dispatch.taskStatus'), this.$t('dispatch.orderStatus'), this.$t('dispatch.callResult'), this.$t('dispatch.callFailedReason'), this.$t('dispatch.dealResult'), this.$t('dispatch.collectRemark'), this.$t('dispatch.appShortName')];
                    const filterVal = ['orderId', 'realName', 'appUserName', 'proName', 'approvedAmt', 'orderCrtTime', 'lastPayDate', 'firstDueDate', 'overdueDay', 'overdueDayNew', 'overdueAmt', 'overdueInterest', 'settleTime', 'attr8', 'groupName', 'baseUserName', 'status', 'orderStatus', 'callResult', 'callFailedReason', 'dealResult', 'collectRemark', 'appShortName'];
                    const list = response.data;
                    const data = this.formatJson(filterVal, list)
                    export_json_to_excel(tHeader, data, this.$t('route.achievement'))
                    this.listLoading = false;
                })
            })
        },
        formatJson(filterVal, jsonData) {
            return jsonData.map(v => filterVal.map(j => {
                // if (j === 'realName' || j === 'appUserName') {
                //     return dataMasking(v[j])
                // }
                return v[j]
            }))
        },
        getList() {
            this.listLoading = true;
            this.collGroup.forEach(item => {
                if(item.code === this.listQuery.collectCode) {
                    this.listQuery.groupId = item.groupBaseId
                }
            })
            this.$store.dispatch('saveCollAchiPage', { path: this.$route.path, listQuery: this.listQuery });
            if (this.tableData.length > 0) {
                this.isDisable2 = false;
            } else {
                this.isDisable2 = true;
            }
            page(this.listQuery)
            .then(response => {
                response.data.rows.forEach(item => {
                    let re = /(?=(?!\b)(\d{3})+$)/g;
                    let str = String(item.approvedAmt)
                    item.approvedAmt =  str.replace(re, ',');
                    let str2 = String(item.overdueAmt)
                    item.overdueAmt =  str2.replace(re, ',');
                    let str3 = String(item.breakAmt)
                    item.breakAmt =  str3.replace(re, ',');
                    let str4= String(item.overdueInterest)
                    item.overdueInterest =  str4.replace(re, ',');
                    let str5 = String(item.breakInterestAmt)
                    item.breakInterestAmt =  str5.replace(re, ',');
                })
                if (response.status === 200) {
                    this.expDis = false;
                    this.listLoading = false;
                    this.tableData = response.data.rows;
                    this.total = Number(response.data.total);
                }
            })
        },
        //查询
        search() {
            this.listQuery.page = 1;
            this.getList();
        },
        //重置
        reset() {
            this.listQuery.limit = 5;
            this.listQuery.page = 1;
            this.listQuery.orderId = "";
            this.listQuery.realName = "";
            this.listQuery.phoneNo = "";
            this.overdueDate = [];
            this.listQuery.orderStatus = "";
            this.listQuery.collectCode = "";
            this.listQuery.overDayBegin = "";
            this.listQuery.overDayEnd = "";
            this.settleRepayDate = [new Date(), new Date()];
            this.listQuery.beginDate = '';
            this.listQuery.endDate = '';
            this.listQuery.beginSettleTime = this.GetDateStr(0);
            this.listQuery.endSettleTime = this.GetDateStr(0);
        },
        handleSizeChange(val) {
            this.listQuery.limit = val;
            this.getList()
        },
        handleCurrentChange(val) {
            this.listQuery.page = val;
            this.getList()
        },
    }
};
</script>

<style scoped lang='scss'>
.box-card {
  width: 95%;
  margin-left: 2.5%;
  margin-right: 2.5%;
}
.title {
  line-height: 30px;
  font-size: 16px;
  display: flex;
  align-items: center;
  font-weight: bold;
}
.title:before{
  display: block;
  content: "";
  width: 3px;
  height: 16px;
  background-color: #309afe;
}
.title:before {
  margin-right: 8px;
}
::before {
  box-sizing: inherit;
  -webkit-tap-highlight-color: transparent;
}
.menu-title {
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  .searchItem {
    display: flex;
    align-items: center;
    padding: 10px  0;
    span {
      display: inline-block;
      width: 100px;
      text-align: right;
      font-size: 12px;
      color: #5f5f61;
      padding-right: 5px;
    }
    div{
      width: 150px;
    }
  }
  .searchItem-date {
    display: flex;
    align-items: center;
    padding: 10px 0;
    span {
      display: inline-block;
      width: 100px;
      text-align: right;
      font-size: 12px;
      color: #5f5f61;
      padding-right: 5px;
    }
    div:nth-child(2) {
      width: 220px;
    }
  }
    .searchItem-overdue {
        display: flex;
        align-items: center;
        padding: 10px  0;
        div {
            width: 48px;
        }
    }
}
.menu-title-btn {
  padding: 10px 0;
  box-sizing: border-box;
  button {
    padding: 0 20px;
    height: 28px;
    background: #20a0ff;
    color: #fff;
    outline: none;
    border-width: 0;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
    &:nth-child(1) {
      margin-left: 0;
    }
    &:nth-child(2) {
      background: #ebf5ff;
      color: #20a0ff;
      border: 1px solid #abd5ff;
    }
  }
  button[disabled] {
    padding: 0 20px;
    height: 28px;
    background: #c1e0ff;
    color: #fafbff;
    outline: none;
    border-width: 0;
    border-radius: 4px;
    font-size: 12px;
  }
}
.menu-list {
  padding: 20px 0;
  box-sizing: border-box;
  button {
    padding: 0 20px;
    height: 28px;
    background: #20a0ff;
    color: #fff;
    outline: none;
    border-width: 0;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
    &:nth-child(1) {
      margin-left: 0;
    }
  }
  button[disabled] {
    padding: 0 20px;
    height: 28px;
    background: #c1e0ff;
    color: #fafbff;
    outline: none;
    border-width: 0;
    border-radius: 4px;
    font-size: 12px;
  }
}

.href {
  border-bottom: 1px solid #000;
  cursor: pointer; 
  &:hover {
    color: #20a0ff;
    border-bottom: 1px solid #20a0ff;
  }
}
.head-title2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btns {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-size: cover;
  background-image: url("../../../assets/images/question-mark.svg");
}
</style>